<?php
//OPTIMIZEME : ce code doit être optimisié
class RolesManagerByActionUpdate 
{	
	public function RolesManagerByActionUpdate($actionid,$view,$request)
    {
    	$actionsList = new Wmp_Model_ActionparamsTable();
    			
    	$currentAction = $actionsList->getAction($actionid);
    	
    	if($currentAction){
    		$request = $request->getPost();
    		$privileges = $request['privilege'];
    		    		
    		if(count($privileges)>0) {
	    		$aclRights = new Wmp_Model_AclrightsTable();
    			foreach ($privileges as $key => $val) {
	    			$aclRights->setPrivilege($actionid,$key,$val);
	    		}
    		}
    	}
    	
    	$view->actionname = $view->translate('Action Num ').$currentAction->id
    									.$view->translate(', Module ').$currentAction->module
    									.$view->translate(', Action Name ')
    									.$currentAction->controller.':'.$currentAction->action
    									.$view->translate(', description :')
    									.$currentAction->description;
		
    }
}